package smartbooks.ui.options;

import smartbooks.ui.util.CommonFunctions;

/**
 *
 * @author Ankit
 */
public class TaxOptionPanel extends javax.swing.JPanel {

    /**
     * Creates new form GeneralOptionPanel
     */
    public TaxOptionPanel() {
        initComponents();
        setVisible(true);
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        taxRateButtonGroup = new javax.swing.ButtonGroup();
        taxPanel = new javax.swing.JPanel();
        taxRatesPanel = new javax.swing.JPanel();
        taxRatesToolBar = new javax.swing.JToolBar();
        addTaxRateButton = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        deleteTaxRateButton = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        editTaxRateButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        taxRatesTable = new javax.swing.JTable();
        taxOptionsPanel = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jCheckBox1 = new javax.swing.JCheckBox();
        jComboBox1 = new javax.swing.JComboBox();

        taxPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tax", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 14))); // NOI18N

        taxRatesPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tax Rates", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N

        taxRatesToolBar.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        taxRatesToolBar.setFloatable(false);
        taxRatesToolBar.setRollover(true);

        addTaxRateButton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        addTaxRateButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/smartbooks/images/add_24-24.png"))); // NOI18N
        addTaxRateButton.setText("Add");
        addTaxRateButton.setFocusable(false);
        addTaxRateButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        addTaxRateButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        addTaxRateButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addTaxRateButtonActionPerformed(evt);
            }
        });
        taxRatesToolBar.add(addTaxRateButton);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel1.setText("   ");
        taxRatesToolBar.add(jLabel1);

        deleteTaxRateButton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        deleteTaxRateButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/smartbooks/images/delete_24-24.png"))); // NOI18N
        deleteTaxRateButton.setText("Delete");
        deleteTaxRateButton.setEnabled(false);
        deleteTaxRateButton.setFocusable(false);
        deleteTaxRateButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        deleteTaxRateButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        taxRatesToolBar.add(deleteTaxRateButton);

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel2.setText("   ");
        taxRatesToolBar.add(jLabel2);

        editTaxRateButton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        editTaxRateButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/smartbooks/images/edit_24-24.png"))); // NOI18N
        editTaxRateButton.setText("Edit");
        editTaxRateButton.setEnabled(false);
        editTaxRateButton.setFocusable(false);
        editTaxRateButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        editTaxRateButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        taxRatesToolBar.add(editTaxRateButton);

        taxRatesTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Name", "Rate"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(taxRatesTable);

        javax.swing.GroupLayout taxRatesPanelLayout = new javax.swing.GroupLayout(taxRatesPanel);
        taxRatesPanel.setLayout(taxRatesPanelLayout);
        taxRatesPanelLayout.setHorizontalGroup(
            taxRatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(taxRatesPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(taxRatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(taxRatesToolBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 423, Short.MAX_VALUE))
                .addContainerGap())
        );
        taxRatesPanelLayout.setVerticalGroup(
            taxRatesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(taxRatesPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(taxRatesToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        taxOptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tax Options", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel3.setText("By Default new items have this tax rate:");

        jCheckBox1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jCheckBox1.setText("By default new customers are tax exempt");

        jComboBox1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        javax.swing.GroupLayout taxOptionsPanelLayout = new javax.swing.GroupLayout(taxOptionsPanel);
        taxOptionsPanel.setLayout(taxOptionsPanelLayout);
        taxOptionsPanelLayout.setHorizontalGroup(
            taxOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(taxOptionsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(taxOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(taxOptionsPanelLayout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jComboBox1, 0, 192, Short.MAX_VALUE))
                    .addGroup(taxOptionsPanelLayout.createSequentialGroup()
                        .addComponent(jCheckBox1)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        taxOptionsPanelLayout.setVerticalGroup(
            taxOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(taxOptionsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(taxOptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jCheckBox1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout taxPanelLayout = new javax.swing.GroupLayout(taxPanel);
        taxPanel.setLayout(taxPanelLayout);
        taxPanelLayout.setHorizontalGroup(
            taxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, taxPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(taxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(taxOptionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(taxRatesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        taxPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {taxOptionsPanel, taxRatesPanel});

        taxPanelLayout.setVerticalGroup(
            taxPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(taxPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(taxRatesPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(taxOptionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(81, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(taxPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(taxPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void addTaxRateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTaxRateButtonActionPerformed
        TaxRateDialog taxRateDialog = new TaxRateDialog(CommonFunctions.getParentJFrame(this), true);
        taxRateDialog.showDialog();
        
    }//GEN-LAST:event_addTaxRateButtonActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addTaxRateButton;
    private javax.swing.JButton deleteTaxRateButton;
    private javax.swing.JButton editTaxRateButton;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JPanel taxOptionsPanel;
    private javax.swing.JPanel taxPanel;
    private javax.swing.ButtonGroup taxRateButtonGroup;
    private javax.swing.JPanel taxRatesPanel;
    private javax.swing.JTable taxRatesTable;
    private javax.swing.JToolBar taxRatesToolBar;
    // End of variables declaration//GEN-END:variables
}
